﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Qiang.Topology.Geometries;

namespace Qiang.Data
{
    [Serializable]
    public class VertexShape : Shape,IVertexShape
    {

        #region 初始化

        /// <summary>
        /// 
        /// </summary>
        public VertexShape()
            : base()
        {           
            this._point = new Coordinate(0, 0);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pt"></param>
        public VertexShape(Coordinate pt)
            : base()
        {            
            this._point = pt;
        }

        #endregion


        #region 属性

        private Coordinate _point;

        /// <summary>
        /// 坐标
        /// </summary>
        public Coordinate Point
        {
            get { return _point; }
            set { _point = value; }
        }


        private ISegmentShape _parentSegment;

        /// <summary>
        /// 依赖弧段
        /// </summary>
        public ISegmentShape ParentSegment
        {
            get { return _parentSegment; }
            set { _parentSegment = value; }
        }

        /// <summary>
        /// shape类型.
        /// </summary>
        public override ShapeType ShapeType
        {
            get
            {
                return ShapeType.Vertex;
            }
        }


        #endregion


        # region 受保护的方法

        protected override IExtent ComputeExtent()
        {
            if (this._point == null) return Qiang.Data.Extent.Empty();
            return new Extent(this._point.X, this._point.Y, this._point.X, this._point.Y);
        }
                

        # endregion

        public override IGeometry ToGeometry()
        {
            throw new NotImplementedException();
        }


    }
}
